﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using PH.Model.Achievements;
using PH.Data.Statistics;
using PH.Logic.Schools;
namespace PH.Logic.Achievements
{
    public class ArchiveLogic
    {
        public static ArchiveModel CreateNew(ArchiveModel model)
        {
            if (model != null)
            {
                model.Guid = Guid.NewGuid();
                model.CreatedOn = DateTime.Now;
                model.ArchiveStatus = 1;
                return ArchiveCommand.CreateNew(model);
            }
            return null;
        }

        public static void Update(ArchiveModel model)
        {
            if (model != null)
            {
                ArchiveCommand.Update(model);
            }
        }

        public static void Delete(Guid guid)
        {
            ArchiveCommand.Delete(guid);
        }

        public static ArchiveModel GetModel(Guid guid)
        {
            return ArchiveCommand.GetModel(guid);
        }

        public static ArchiveCollection Gets(ArchiveQuery sea)
        {
            return ArchiveCommand.Gets(sea);
        }

        public static ArchiveCollection GetArchivesByStudent(Guid stuGuid)
        {
            var student = StudentLogic.GetStudent(stuGuid);
            if (student != null)
            {
                return ArchiveCommand.GetArchivesByStudent(student.ID);
            }
            return new ArchiveCollection();
        }

        public static ArchiveCollection GetMyArchives(ArchiveQuery sea)
        {
            return ArchiveCommand.GetMyArchives(sea);
        }
    }
}
